<html>
<head>
    <title>Input to LaTeX</title>
    <link rel="stylesheet" type="text/css" title="Help with LaTeX" href="latex.css">
</head>
<body>

<h3>Hypertext Help with LaTeX</h3>

<h2>Input to LaTeX</h2>

<p>Input to LaTeX is plain text (ascii) which includes both the
    text of the document and also formatting commands. It is
    possible to <a href="ltx-165.html">split the input</a> into
    several files using:</p>

<ul>
    <li><tt><a href="ltx-245.html">\include</a></tt></li>
    <li><tt><a href="ltx-248.html">\input</a></tt></li>
</ul>

<p>Space characters separate words. Two space characters in a
    row are equivalent to a single space character. The end of line
    is also equivalent to a space character. (However, a percent
    sign, <tt><a href="ltx-434.html">%</a></tt>, can end a line
    without generating a space character.) Generally, space
    characters at the beginning of a line are ignored.</p>

<p>An empty or blank line between two lines of text defines
    <a href="ltx-111.html">a new paragraph</a>. Two blank lines are
    equivalent to one.</p>

<h3>Special Characters</h3>

<p>The following ten characters are
    <a href="ltx-164.html">Special LaTeX Characters</a>:</p>

<pre>
    $ & % # _ { } ~ ^ \
</pre>

<p>If entered directly in the input they cause LaTeX to do
    something special. You can get the following seven of them into
    your document by simply preceding them with a backslash
    (<tt>\</tt>):</p>

<pre>
    $ & % # _ { }
</pre>

<p>To get the other three (<tt> ~ ^ \ </tt>) in your output
    requires <a href="ltx-164.html">more work</a>.</p>

<h3>LaTex Commands</h3>

<p>Commands take one of two forms</p>

<ul>
    <li>a backslash (<tt>\</tt>) followed by a single special character</li>
    <li>a bacslash (<tt>\</tt>) followed by a string of letters</li>
</ul>

<p>The second case is case-sensitive;
    <tt><a href="ltx-405.html">\Gamma</a></tt> is different from
    <tt><a href="ltx-405.html">\gamma</a></tt>. These commands are
    terminated by a nonletter, i.e., a blank, a number, a
    punctuation mark or special character. </p>

<p>Commands may have mandatory arguments, which are input in
    braces (<tt>{}</tt>). They may also have optional arguments,
    which are input in square brackets (<tt>[]</tt>).</p>

<p>For commands which produce text a trailing blank may be
    interpreted as the end of the command, which does not
    automatically create a space, so you may have to do something to
    create an <a href="ltx-431.html">interword space</a> after this text.</p>

<h3><a name="structure">Structure of Input</a></h3>

<p>LaTeX input normally begins with a
    <tt><a href="ltx-22.html">\documentstyle</a></tt> command. (In
    LaTeX2e this is replaced with a
    <tt><a href="versions.html">\documentclass</a></tt> command.)</p>

<p>The beginning of the document text follows a
    <tt>\begin{document}</tt> command.</p>

<p>Input between the <tt>\documentstyle</tt> and
    <tt>\begin{document}</tt> is called the <em>preamble</em> and
    typically contains <a href="ltx-17.html">new command
        definitions</a>, information for the
    <a href="ltx-263.html">title</a>,
    <a href="declarations.html">declarations</a> which affect things
    like <a href="ltx-176.html">Typefaces</a>, etc.</p>

<p>The document text (and generally also the LaTeX input) is
    terminated by a <tt>\end{document}</tt> command.</p>

<p>It is possible to obtain some of the input from
    <a href="ltx-165.html">external files</a>, i.e., those which are
    not the main file input to the LaTeX program.</p>

<hr noshade="noshade" size="1">

<p>See also </p>

<ul>
    <li><a href="ltx-165.html">Splitting the input</a></li>
    <li><a href="ltx-164.html">Special Characters</a></li>
    <li><a href="ltx-99.html">Line and Page Breaking</a></li>
    <li><a href="ltx-111.html">Making Paragraphs</a></li>
    <li><a href="ltx-143.html">Spaces and Boxes</a></li>
</ul>

<p>Back to the <a href="ltx-2.html">Table of Contents</a></p>

<hr noshade="noshade" size="1">
<address>
    Revised 30 Oct 1995.
</address>
</body>
</html>
